package com.example.campuslink.commen.db.comment

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update

@Dao
interface CommentDao {
    @Query("SELECT MAX(id) FROM comment_table")
    fun getMaxId(): Int?

//    @Query("SELECT MAX(parentId) from comment_table")
//    fun getMaxParentId(): Int?

    @Update
    fun updateComment(commentTable: CommentTable)

    @Insert
    fun insertComment(commentTable: CommentTable)

    @Query("SELECT * FROM comment_table")
    fun getAllComment(): List<CommentTable>

    @Query("SELECT * FROM comment_table WHERE id = :id and commentUserNumber=:commentUserNumber")
    fun getCommentById(id: Int, commentUserNumber: String): CommentTable?
}